#include <iostream>
using namespace std;

#include <boost/pool/pool.hpp>
#include <boost/pool/object_pool.hpp>
using namespace boost;

class Student
{
public:
    Student(const string &name, bool sex = false) 
        : m_name(name), m_sex(sex) {
        cout << "Student construct: " << m_name << endl;
    }
    ~Student() {
        cout << "Student destruct: " << m_name << endl;
    }
    void print() {
        cout << "Name:" << m_name << ", Sex:" << m_sex << endl;
    }
private:
    string m_name;
    bool m_sex;
};

int main()
{
    cout << "--- Start ---" << endl;
    object_pool<Student> pl;
    Student *pS1 = pl.construct("Hevake");
    Student *pS2 = pl.construct("Li Chunjun");
    Student *pS3 = pl.construct("Lily", true);
    pS1->print();
    pl.destroy(pS2);
    pl.destroy(pS1);
    cout << "--- End ---" << endl;
    return 0;
}
